/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package ejb;

import java.io.Serializable;
import java.math.BigDecimal;
import java.util.Collection;
import javax.persistence.Basic;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.OneToMany;
import javax.persistence.Table;

/**
 *
 * @author longdm0708l
 */
@Entity
@Table(name = "Ship")
@NamedQueries({@NamedQuery(name = "Ship.findAll", query = "SELECT s FROM Ship s"), @NamedQuery(name = "Ship.findByShipId", query = "SELECT s FROM Ship s WHERE s.shipId = :shipId"), @NamedQuery(name = "Ship.findByShipVia", query = "SELECT s FROM Ship s WHERE s.shipVia = :shipVia"), @NamedQuery(name = "Ship.findByShipPrice", query = "SELECT s FROM Ship s WHERE s.shipPrice = :shipPrice")})
public class Ship implements Serializable {
    private static final long serialVersionUID = 1L;
    @GeneratedValue(strategy=GenerationType.IDENTITY)
    @Id
    @Basic(optional = false)
    @Column(name = "ShipId")
    private Integer shipId;
    @Basic(optional = false)
    @Column(name = "ShipVia")
    private String shipVia;
    @Column(name = "ShipPrice")
    private BigDecimal shipPrice;
    @OneToMany(mappedBy = "shipId")
    private Collection<OrderDetail> orderDetailCollection;

    public Ship() {
    }

    public Ship(Integer shipId) {
        this.shipId = shipId;
    }

    public Ship(Integer shipId, String shipVia) {
        this.shipId = shipId;
        this.shipVia = shipVia;
    }

    public Integer getShipId() {
        return shipId;
    }

    public void setShipId(Integer shipId) {
        this.shipId = shipId;
    }

    public String getShipVia() {
        return shipVia;
    }

    public void setShipVia(String shipVia) {
        this.shipVia = shipVia;
    }

    public BigDecimal getShipPrice() {
        return shipPrice;
    }

    public void setShipPrice(BigDecimal shipPrice) {
        this.shipPrice = shipPrice;
    }

    public Collection<OrderDetail> getOrderDetailCollection() {
        return orderDetailCollection;
    }

    public void setOrderDetailCollection(Collection<OrderDetail> orderDetailCollection) {
        this.orderDetailCollection = orderDetailCollection;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (shipId != null ? shipId.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof Ship)) {
            return false;
        }
        Ship other = (Ship) object;
        if ((this.shipId == null && other.shipId != null) || (this.shipId != null && !this.shipId.equals(other.shipId))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "ejb.Ship[shipId=" + shipId + "]";
    }

}
